<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/admincontent.jsp" %>
<div id="Content">
    <form id="recommendmodelform" method="post" action="/DUserResume/RecommendPostAction">
        <input type="hidden" name="pid" value="${pid}"/>
        <input type="hidden" name="fid" value="${fid}"/>
        <input type="hidden" name="deptcode" value="${deptcode}"/>
        ${ids}
        <table class="treeTable searchform">
            <tbody>
            <tr>
                <td width="75">推荐到岗位：</td>
                <td width="200">
                    <div>
                        <select name="gwcode" datatype="*" nullmsg="请选择推荐到的岗位">
                            <option value="">请选择</option>
                            ${jobs}
                        </select>
                        <input type="hidden" name="gwname" datatype="*" nullmsg="请选择推荐到的岗位"/>
                    </div>
                </td>

                <td></td>
            </tr>
            <tr>
                <td width="75">是否需要重置流程：</td>
                <td width="200">
                    <div>
                        <div>
                            <input type="radio" name="needReplan" value="NO" checked> 无需重置
                            <input type="radio" name="needReplan" value="YES"> 需要重置
                        </div>
                    </div>
                </td>
                <td></td>
            </tr>
            <tr>
                <td width="75">是否需要应聘者确认：</td>
                <td width="200">
                    <div>
                        <input type="radio" name="needConfirm" value="无需确认" checked> 无需确认
                        <input type="radio" name="needConfirm" value="需要确认"> 需要确认
                    </div>
                </td>
                <td width="80">
                    <button class="op" id="btn_submit">立即推荐</button>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
    <table class="treeTable" style="margin-top:5px;">
        <thead>
        <tr>
            <td width="80">简历编号</td>
            <td width="120">应聘职位</td>
            <td width="80">姓名</td>
            <td width="60">性别</td>
            <td>证件号码</td>
        </tr>
        </thead>
        <tbody>${rs}</tbody>
    </table>
</div>
<script src="<%=basepath%>/resources/js/loginVerification.js" type="text/javascript"></script>
<script>
  //  $(function () {

      $('select[name=gwcode]').change(function () {
          $('input[name=gwname]').val($('select[name=gwcode]').find("option:selected").text());
      });

     /*   $("#recommendmodelform").Validform({
            ajaxPost: true,
            datatype: {//传入自定义datatype类型
                "zdata": /^[1-9]?\d{1}(\.\d+)?$/,
                //大于等于0的整数
                "zzs": /^([1-9]\d{0,}|0)$/,
                //大于0的整数
                "zzzs": /^[1-9]\d{0,}$/,
                //大于0的数
                "zs": /^[ + ]?(0\.\d+)|([1-9][0-9]*(\.\d+)?)$/
            },
            callback: function (data) {
                if (data.state) {
                    $.Showmsg(data.Message);
                    //parent.parent.layer.alert(data.Message);
                    parent.frames["mainiframe"].contentWindow.getList();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                } else {
                    //parent.parent.layer.alert(data.Message);
                    $.Showmsg(data.Message);
                }
            }
        });*/

  //  });


    $('#btn_submit').click(function () {

        var cfindex=  parent.layer.confirm(
            '1、简历筛选后的流转信息及发布信息将会被清除!<br>' +
            '2、如需要审核,审核完成后简历筛选后的流转信息将会被清除!<br>' +
            '3、简历筛选后的相关数据请重新输入！<br>确定要进行转岗操作吗？',
            {
            title:"温馨提示",
            btn: ['是', '否']
        }, function () {
            var obj = $('#recommendmodelform input[name=gwname]');
            if (obj.val().length == 0) {//检查是否有输入
                layui.use(['layer', 'form'], function () {
                    layer.alert("请选择需要推荐到岗位！", {icon: 2});
                });
            }else{
               var gwnameVal =obj.val();
               var gwcodeVal = $('#recommendmodelform select[name=gwcode]').val()
               var radioReplan =$('input:radio[name="needReplan"]:checked').val();
               var radioConfirm =$('input:radio[name="needConfirm"]:checked').val();
               var idVal = $('#recommendmodelform input[name=id]').val();


               $.ajax({
                    url: "/DUserResume/RecommendPostAction",
                    data: 'pid=${pid}&fid=${fid}&deptcode=${deptcode}&id='+idVal+'&gwcode='+gwcodeVal+
                        '&gwname='+gwnameVal+'&needReplan='+radioReplan+'&radioConfirm='+radioConfirm,
                    type: "POST",
                    datatype:"xhr",
                    success: function(data){
                      //    console.log(data);
                        if (data.state) {
                           // $.Showmsg(data.Message);

                            layui.use(['layer', 'form'], function(){
                                layer.msg(data.Message,{icon:1})
                            });
                            parent.frames["mainiframe"].contentWindow.getList();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        } else {
                           // $.Showmsg(data.Message);
                            layui.use(['layer', 'form'], function(){
                                layer.msg(data.Message,{icon:2})
                            });
                        }
                    }
                });
            }

            parent.layer.close(cfindex);
            return false;
        }, function () {
            parent.layer.close(cfindex);
        });
        return false;
    });
</script>

</body>
</html>